// pages/loupan/searchlist.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    houses:'',
    oldhouses:'',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var content = options.content;
    this.searchdesc(content)
  },
  searchdesc(content) {
    wx.showLoading({
      title: '加载中',
    })
    var that = this;
    var setid = app.globalData.cityCode;
    var searchvalue = that.data.searchvalue;
    app.core('get', 'search_loupan_by_name/site_id/' + setid + '', {
      project_name: content
    }, (res) => {
      console.log(res)
      var houses = res.data.houses;
      var arr = res.data.oldhouses;
      for (var i = 0; i < arr.length;i++){
        switch (arr[i].propertyType) {
          case 1:
            arr[i].propertyType = '住宅'
            break;
          case 2:
            arr[i].propertyType = '商铺'
            break;
          case 3:
            arr[i].propertyType = '写字楼'
            break;
        }
        switch (arr[i].publisherType) {
          case 1:
            arr[i].publisherType = '普通'
            break;
          case 2:
            arr[i].publisherType = '经纪人'
            break;
          case 3:
            arr[i].publisherType = '中介'
            break;
          case 4:
            arr[i].publisherType = '律师'
            break;
        }
      }

      that.setData({
        houses: houses,
        oldhouses: arr,
      })
      wx.hideLoading()
    })

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})